package com.tjw.ec.auth.controller;

import com.tjw.ec.common.core.util.PageUtils;
import com.tjw.ec.common.core.util.R;
import com.tjw.ec.common.core.util.Response;
import com.tjw.ec.upms.api.entity.ActionEntity;
import com.tjw.ec.upms.api.feign.RemoteActionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;
import java.util.Map;

/**
 * <p>必须要有，做验证</p>
 * Created by Mr.Yangxiufeng on 2017/12/29.
 * Time:10:43
 * ProjectName:Mirco-Service-Skeleton
 */
@RestController
public class UserController {

    @Autowired
    RemoteActionService remoteActionService;

    @RequestMapping("/user")
    public Principal user(Principal user) {
        return user;
    }


    /**
     * 远程调用测试列表接口
     */
    @GetMapping("/list2")
    public R list2(@RequestParam Map<String, Object> params) {
        Response<PageUtils<ActionEntity>> list = remoteActionService.page(params);
        return R.data(list.getData());
    }
}
